<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>ui_observer</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : April 1993</div>
    <p>
      <b>ui_observer</b> -  unknown input observer</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[UIobs,J,N]=ui_observer(Sys,reject,C1,D1)  </tt>
      </dd>
      <dd>
        <tt>[UIobs,J,N]=ui_observer(Sys,reject,C1,D1,flag,alfa,beta)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>Sys</b>
        </tt>: <tt>
          <b>syslin</b>
        </tt> list containing the matrices <tt>
          <b>(A,B,C2,D2)</b>
        </tt>.</li>
      <li>
        <tt>
          <b>reject</b>
        </tt>: integer vector, indices of inputs of <tt>
          <b>Sys</b>
        </tt> which are unknown.</li>
      <li>
        <tt>
          <b>C1</b>
        </tt>: real matrix</li>
      <li>
        <tt>
          <b>D1</b>
        </tt>: real matrix. <tt>
          <b>C1</b>
        </tt> and <tt>
          <b>D1</b>
        </tt> have the same number of rows.</li>
      <li>
        <tt>
          <b>flag</b>
        </tt>: string <tt>
          <b>'ge'</b>
        </tt> or <tt>
          <b>'st'</b>
        </tt> (default) or <tt>
          <b>'pp'</b>
        </tt>.</li>
      <li>
        <tt>
          <b>alfa</b>
        </tt>: real or complex vector (loc. of closed loop poles)</li>
      <li>
        <tt>
          <b>beta</b>
        </tt>: real or complex vector (loc. of closed loop poles)</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    Unknown input observer.</p>
    <p>
      <tt>
        <b>Sys: (w,u) --&gt; y</b>
      </tt> is a <tt>
        <b>(A,B,C2,D2)</b>
      </tt> syslin linear system with 
    two inputs w and u, w being the unknown input.
    The  matrices B and D2 of Sys are (implicitly) partitioned as:
    <tt>
        <b>B=[B1,B2]</b>
      </tt> and <tt>
        <b>D2=[D21,D22]</b>
      </tt>  with <tt>
        <b>B1=B(:,reject)</b>
      </tt>  and 
    <tt>
        <b>D21=D2(:,reject)</b>
      </tt> where reject = indices of unknown inputs.
    The matrices <tt>
        <b>C1</b>
      </tt> and <tt>
        <b>D1</b>
      </tt> define <tt>
        <b>z = C1 x + D1 (w,u)</b>
      </tt>,
    the to-be-estimated output.</p>
    <p>
    The matrix <tt>
        <b>D1</b>
      </tt> is (implicitly) partitioned as <tt>
        <b>D1=[D11,D12]</b>
      </tt>
    with <tt>
        <b>D11=D(:,reject)</b>
      </tt>
    </p>
    <p>
    The data (Sys, reject,C1, D1)   define a 2-input 2-output system:</p>
    <pre>

  xdot =  A x + B1  w + B2  u
     z = C1 x + D11 w + D12 u
     y = C2 x + D21 w + D22 u
   
    </pre>
    <p>
    An observer <tt>
        <b>(u,y) --&gt; zhat</b>
      </tt> is looked for the output z.</p>
    <p>
      <tt>
        <b>flag='ge'</b>
      </tt> no stability constraints
    <tt>
        <b>flag='st'</b>
      </tt> stable observer    (default) 
    <tt>
        <b>flag='pp'</b>
      </tt> observer with pole placement
    alfa,beta = desired location of closed loop poles  (default -1, -2)
    J=y-output to x-state injection.
    N=y-output to z-estimated output injection.</p>
    <p>
    UIobs = linear system (u,y) --&gt; zhat such that:
    The transfer function: (w,u) --&gt; z  equals the composed transfer function:
                [0,I;        UIobs
                 Sys]
          (w,u) -----&gt; (u,y) -----&gt; zhat
    i.e. transfer function of system {A,B,C1,D1} equals transfer function 
    <tt>
        <b>UIobs*[0,I; Sys]</b>
      </tt>
    </p>
    <p>
    Stability (resp. pole placement) requires detectability
    (resp. observability) of (A,C2).</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

A=diag([3,-3,7,4,-4,8]);
B=[eye(3,3);zeros(3,3)];
C=[0,0,1,2,3,4;0,0,0,0,0,1];
D=[1,2,3;0,0,0];
rand('seed',0);w=ss2ss(syslin('c',A,B,C,D),rand(6,6));
[A,B,C,D]=abcd(w);
B=[B,matrix(1:18,6,3)];D=[D,matrix(-(1:6),2,3)];
reject=1:3;
Sys=syslin('c',A,B,C,D);
N1=[-2,-3];C1=-N1*C;D1=-N1*D;
nw=length(reject);nu=size(Sys('B'),2)-nw;
ny=size(Sys('C'),1);nz=size(C1,1);
[UIobs,J,N]=ui_observer(Sys,reject,C1,D1);

W=[zeros(nu,nw),eye(nu,nu);Sys];UIobsW=UIobs*W;   
//(w,u) --&gt; z=UIobs*[0,I;Sys](w,u)
clean(ss2tf(UIobsW));
wu_to_z=syslin('c',A,B,C1,D1);clean(ss2tf(wu_to_z));
clean(ss2tf(wu_to_z)-ss2tf(UIobsW),1.d-7)
/////2nd example//////
nx=2;ny=3;nwu=2;Sys=ssrand(ny,nwu,nx);
C1=rand(1,nx);D1=[0,1];
UIobs=ui_observer(Sys,1,C1,D1);
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="cainv.htm">
        <tt>
          <b>cainv</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="ddp.htm">
        <tt>
          <b>ddp</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="abinv.htm">
        <tt>
          <b>abinv</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Author</font>
    </h3>
    <p>F.D.  </p>
  </body>
</html>
